package ro.pub.cs.hwchecker.comm.client.req;

import ro.pub.cs.hwchecker.comm.client.data.Archive;
import ro.pub.cs.hwchecker.comm.client.data.Homework;
import ro.pub.cs.hwchecker.comm.client.data.StudentSummary;

public interface ApplicationRequestBuilder {
	/**
	 * This request queries the server for the list of homework associated
	 * with the course. This request is used during the application
	 * initialization, when the user interface is built.
	 * 
	 * @param callback
	 * @return
	 * @throws CheckerRequestException
	 */
	CheckerRequest performHomeworkListRequest(CheckerCallback<Homework[]> callback)
			throws CheckerRequestException;
	
	/**
	 * This request asks the server for summary information (statistics) useful
	 * for a student. This request saves the application from asking for
	 * all the data from the server and performing the statistics on the client.
	 * 
	 * @param callback
	 * @return
	 * @throws CheckerRequestException
	 */
	CheckerRequest performStudentSummaryRequest(CheckerCallback<StudentSummary> callback)
			throws CheckerRequestException;
	
	/**
	 * This request asks the server for the list of archives associated
	 * with a homework. The archives are ordered from the most recent to
	 * the earliest sent. The first archive in the list is the active one
	 * (that accounts for grading).
	 * 
	 * @param hwID
	 * @param callback
	 * @return
	 * @throws CheckerRequestException
	 */
	CheckerRequest performHomeworkRequest(String hwID, 
			CheckerCallback<Archive[]> callback) throws CheckerRequestException;
	
	/**
	 * This request asks the server for the latest information regarding
	 * a specific archive. This request is used after an archive is submitted
	 * and its status is updated in real time.
	 * 
	 * @param arID
	 * @param callback
	 * @return
	 * @throws CheckerRequestException
	 */
	CheckerRequest performArchiveRequest(String arID, 
			CheckerCallback<Archive> callback) throws CheckerRequestException;
	
	/**
	 * This request asks the server for a piece of the evaluation log of
	 * an archive, starting from the specified position in the log file. Thus,
	 * it becomes easy to request only diffs for a rather large file.
	 * @param arID
	 * @param startingFrom The 
	 * @param callback
	 * @return
	 * @throws CheckerRequestException
	 */
	CheckerRequest performLogRequest(String arID, int startingFrom,
			CheckerCallback<String> callback) throws CheckerRequestException;
}
